from typing import Tuple
import pygame

from game.data.assets.assetManager import load_image
from game.ui.ui import UI
from game.ui.widgets.image import ImageWidget
from game.ui.widgets.text import TextWidget
from game.container import Variables
from game.sound import ChannelManager


class SettingsMenu(UI):
    def __init__(self,
                 groups: Tuple[pygame.sprite.LayeredUpdates, ...],
                 ):
        super().__init__(groups)

        # ====================
        # = Background Image =
        # ====================
        self.background = ImageWidget(
            self.display_surface,
            load_image("test/Black_clarity.png"),
            self.display_surface.get_rect().center,
            self.groups)

        # ====================
        # = Back to Main Menu text =
        # ====================
        def __callback_backto_main_menu_text():
            from game.ui.menus import Menus
            self.jumpto(Menus.main_menu)  # type: ignore

        TextWidget(self.display_surface,
                   (100, 100),
                   self.groups,
                   "主菜单",
                   pygame.Color(0, 0, 0),
                   pygame.Color(255, 255, 255),
                   on_click_callbacks=(__callback_backto_main_menu_text,))


    def update(self) -> None:
        super().update()